﻿// Copyright (c) egmkang wang. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Configuration;

public static class HostSettings
{
    public static bool EnableProfile
    {
        get
        {
            var str = ConfigurationManager.AppSettings["profile"];
            return String.IsNullOrEmpty(str) && Convert.ToBoolean(str);
        }
    }

    public static string LogPrefix
    {
        get
        {
            var str = ConfigurationManager.AppSettings["log_prefix"];
            return String.IsNullOrWhiteSpace(str) ? "gateway" : str;
        }
    }

    public static NLog.LogLevel LogLevel
    {
        get
        {
            var str = ConfigurationManager.AppSettings["log_level"];
            return String.IsNullOrWhiteSpace(str) ? NLog.LogLevel.Debug : NLog.LogLevel.FromString(str);
        }
    }

    public static string ConfigPath
    {
        get
        {
            var str = ConfigurationManager.AppSettings["config"];
            return string.IsNullOrEmpty(str) ? "." : str;
        }
    }

    public static string MysqlIp => ConfigurationManager.AppSettings["mysql_ip"];
    public static string MysqlDB => ConfigurationManager.AppSettings["mysql_db"];
    public static string MysqlUser => ConfigurationManager.AppSettings["mysql_user"];
    public static string MysqlPassword => ConfigurationManager.AppSettings["mysql_password"];
    public static string DbName => ConfigurationManager.AppSettings["db_name"];
}

